DLG_REPORTS Dialog Component

Description

Dynamically populates the radio button selections from the web_reports table.

Discussion

The DLG_REPORTS dialog component selects an administrative report to run. The report options are:

  • Customer List

  • Customer Summary List

  • Invoice

  • Product List

  • Vendor List

The DLG_REPORTS dialog component includes options to change the report output format. The options are:

  • PDF

  • HTML

    images/ASW_dlg_reports.gif

The DLG_REPORTS dialog component dynamically populates the radio button selections from the web_reports table. While the list displays the rpt_name field, the user's selection returns the rpt_id field. Using a table lookup like this makes it possible to add reports to the application later, without having to change the dialog component. The AfterValidate contains the code that runs the selected report.

Reports Control Properties

Outputas Control Properties

Notable Component Property Settings

Event Code

The AfterValidate event code was built by modifying the code created by the Print Reports genie from the Insert button in the event.

outputAs = lower( alltrim(CurrentForm.Controls.OutputAs) )
dim filter as c 
dim order as c
Filter = ".T."
Order = ""
Dim filename as c
' replace code generated by genie to create a file name based on the report name
dim flname as c
flname = word(alltrim(CurrentForm.Controls.Reports),1,"@") 'get report name from radio control value that includes full path
flname = stritran(flname," ","_") + "_"+dtoc(date(),"1-")+"." + OutputAs ' replace spaces with underscore and add a date value
filename = session.session_folder + flname
filename = report.saveas(alltrim(CurrentForm.Controls.Reports),outputAs,filter,order,filename,.f.)
if file.exists(filename)
    currentform.RedirectTarget = session.session_url + flname+ "?" + time("hms3")
end if

See Also